package main

import (
	"fmt"
	"runtime/debug"
)

// 引入C的头文件

/*
#cgo CFLAGS: -I./ccode
#cgo LDFLAGS: -L./libs -lav -lclamav -lstdc++
#include "av.h"
*/
import "C"

func main() {
	C.AVInit()
	startWebService()
}

func myRecover() {
	if err := recover(); err != nil {
		fmt.Println(string(debug.Stack()))
	}
}

func scanOneFile(onefile string) string {
	if len(onefile) < 1 {
		return "{'status':'error','message':'miss json param: filename'}"
	}
	if ok, _ := PathExists(onefile); !ok {
		return "{'status':'error','message':'file not found'}"
	}

	virname := C.GoString(C.AVScanFile(C.CString(onefile)))
	return fmt.Sprintf("{'status':'ok','message':'','result':'%s'}", virname)
}
